\(\int (a+b \sin ^2(e+f x)) \, dx\) [288]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 12, antiderivative size = 30 \[ \int \left (a+b \sin ^2(e+f x)\right ) \, dx=a x+\frac {b x}{2}-\frac {b \cos (e+f x) \sin (e+f x)}{2 f} \]

[Out]

a*x+1/2*b*x-1/2*b*cos(f*x+e)*sin(f*x+e)/f

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {2715, 8} \[ \int \left (a+b \sin ^2(e+f x)\right ) \, dx=a x-\frac {b \sin (e+f x) \cos (e+f x)}{2 f}+\frac {b x}{2} \]

[In]

Int[a + b*Sin[e + f*x]^2,x]

[Out]

a*x + (b*x)/2 - (b*Cos[e + f*x]*Sin[e + f*x])/(2*f)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rubi steps \begin{align*} \text {integral}& = a x+b \int \sin ^2(e+f x) \, dx \\ & = a x-\frac {b \cos (e+f x) \sin (e+f x)}{2 f}+\frac {1}{2} b \int 1 \, dx \\ & = a x+\frac {b x}{2}-\frac {b \cos (e+f x) \sin (e+f x)}{2 f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.07 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.10 \[ \int \left (a+b \sin ^2(e+f x)\right ) \, dx=a x+\frac {b (e+f x)}{2 f}-\frac {b \sin (2 (e+f x))}{4 f} \]

[In]

Integrate[a + b*Sin[e + f*x]^2,x]

[Out]

a*x + (b*(e + f*x))/(2*f) - (b*Sin[2*(e + f*x)])/(4*f)

Maple [A] (verified)

Time = 0.37 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.80

method result size
risch \(a x +\frac {b x}{2}-\frac {\sin \left (2 f x +2 e \right ) b}{4 f}\) \(24\)
parallelrisch \(\frac {b \left (2 f x -\sin \left (2 f x +2 e \right )\right )}{4 f}+a x\) \(27\)
default \(a x +\frac {b \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}\) \(32\)
parts \(a x +\frac {b \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}\) \(32\)
derivativedivides \(\frac {a \left (f x +e \right )+b \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}\) \(37\)
norman \(\frac {\left (a +\frac {b}{2}\right ) x +\frac {b \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}+\left (a +\frac {b}{2}\right ) x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (2 a +b \right ) x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )-\frac {b \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{2}}\) \(92\)

[In]

int(a+b*sin(f*x+e)^2,x,method=_RETURNVERBOSE)

[Out]

a*x+1/2*b*x-1/4/f*sin(2*f*x+2*e)*b

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.97 \[ \int \left (a+b \sin ^2(e+f x)\right ) \, dx=\frac {{\left (2 \, a + b\right )} f x - b \cos \left (f x + e\right ) \sin \left (f x + e\right )}{2 \, f} \]

[In]

integrate(a+b*sin(f*x+e)^2,x, algorithm="fricas")

[Out]

1/2*((2*a + b)*f*x - b*cos(f*x + e)*sin(f*x + e))/f

Sympy [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.70 \[ \int \left (a+b \sin ^2(e+f x)\right ) \, dx=a x + b \left (\begin {cases} \frac {x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {x \cos ^{2}{\left (e + f x \right )}}{2} - \frac {\sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} & \text {for}\: f \neq 0 \\x \sin ^{2}{\left (e \right )} & \text {otherwise} \end {cases}\right ) \]

[In]

integrate(a+b*sin(f*x+e)**2,x)

[Out]

a*x + b*Piecewise((x*sin(e + f*x)**2/2 + x*cos(e + f*x)**2/2 - sin(e + f*x)*cos(e + f*x)/(2*f), Ne(f, 0)), (x*
sin(e)**2, True))

Maxima [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.97 \[ \int \left (a+b \sin ^2(e+f x)\right ) \, dx=a x + \frac {{\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} b}{4 \, f} \]

[In]

integrate(a+b*sin(f*x+e)^2,x, algorithm="maxima")

[Out]

a*x + 1/4*(2*f*x + 2*e - sin(2*f*x + 2*e))*b/f

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.83 \[ \int \left (a+b \sin ^2(e+f x)\right ) \, dx=\frac {1}{4} \, b {\left (2 \, x - \frac {\sin \left (2 \, f x + 2 \, e\right )}{f}\right )} + a x \]

[In]

integrate(a+b*sin(f*x+e)^2,x, algorithm="giac")

[Out]

1/4*b*(2*x - sin(2*f*x + 2*e)/f) + a*x

Mupad [B] (verification not implemented)

Time = 13.57 (sec) , antiderivative size = 27, normalized size of antiderivative = 0.90 \[ \int \left (a+b \sin ^2(e+f x)\right ) \, dx=-\frac {\frac {b\,\sin \left (2\,e+2\,f\,x\right )}{4}-f\,x\,\left (a+\frac {b}{2}\right )}{f} \]

[In]

int(a + b*sin(e + f*x)^2,x)

[Out]

-((b*sin(2*e + 2*f*x))/4 - f*x*(a + b/2))/f